import redis


class RedisListenerTest:
	def __init__(self, host, port, db, password):
		self._client = redis.Redis(host=host, port=port, db=db, password=password)
		self._running = True

	def listen(self):
		while self._running is True:
			user_input = input()
			input_bytes = user_input.encode('utf-8')
			if user_input == 'end':
				self._running = False
				self._client.lpush('command', input_bytes)
			else:
				self._client.lpush('action', input_bytes)


if __name__ == '__main__':
	listener = RedisListenerTest('localhost', 6379, 0, None)
	listener.listen()
